#ifndef PLAYER_H
#define PLAYER_H

#include <QObject>
#include "cards.h"
class Player : public QObject
{
    Q_OBJECT
public:
    enum Role{Lord, Farmer}; //角色
    enum SSex{Man, Woman}; //性别
    enum Direction{Left, Right}; // 方向
    enum Type{Robot, User, UnKnow}; // 玩家类别

    explicit Player(QObject *parent = nullptr);
    explicit Player(QString name,QObject *parent = nullptr);
    // 名字
    void setName(QString name);
    QString getName();
    // 性别
    void setSSex(SSex sex);
    SSex getSSex();
    // 设置角色
    void setRole(Role role);
    Role getRole();
    // 设置方向
    void setDirection(Direction direction);
    Direction getDirection();
    // 玩家类型
    void setType(Type type);
    Type getType();
    // 分数
    void setScore(int score);
    int getScore();
    // 游戏结果
    void setWin(bool flag);
    bool isWin();
   // 提供当前对象的上家/下家对象
    void setPrevPlayer(Player* player);
    void setNextPlayer(Player* player);
    Player* getPrevPlayer();
    Player* getNextPlayer();
    //叫地主
    void grabLordBet(int point);
    void storeDispatchCard(Card &card);
    void storeDispatchCard(Cards &cards);

    //得到所有的牌
    Cards getCards();
    //清空玩家所有扑克牌
    void clearCards();
    //出牌
    void playHand(Cards& cards);
    //设置 出牌玩家已经待处理的扑克牌
    void setPendingInfo(Player* player, Cards& cards);
    Player* getPendPlayer();
    Cards getPendCards();
    // 虚函数
    virtual void prepareCallLord();
    virtual void preparePlayHand();


signals:

public slots:
private:
    int m_score = 0;
    QString m_name;
    Role m_role;
    SSex m_sex;
    Direction m_direction;
    Type m_type;
    bool m_isWin;
    Player* m_prev;
    Player* m_next;
    Cards m_cards;
    Cards m_pendCards;
    Player* m_pendPlyaer;

};

#endif // PLAYER_H
